/******************************************************************************************************
Copyright (C) 2010 Mestrelab Research S.L. All rights reserved.

This file is part of the MNova scripting toolkit.

Authorized users of MNova Software may use this file freely, but this file is provided AS IS
with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE.
*****************************************************************************************************/

function spinSimulationTest()
{
	if(Application.NMRPredictor == undefined)
		throw "Predictor Plugin not loaded";

	var filename = FileDialog.getOpenFileName ( "XML Files(*.xml);;All files (*.*)", "Select Simulation File" );
	if(filename != undefined)
	{
		var file = new File(filename);
		if(file.open(File.ReadOnly))
		{
			var txtStrm = TextStream(file);
			var xmlString = new String(txtStrm.readAll());
			Application.NMRPredictor.loadSimulation(xmlString);
		}
		else
		{
			MessageBox.critical("Unable to Open File", MessageBox.Ok);
		}
	}
	else
	{
		MessageBox.critical("Error Loading Simulation", MessageBox.Ok);
	}
}
